home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SUPERPD.PAK / IPFRAME.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  109 lines

  1. // ipframe.cpp : implementation of the CInPlaceFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. #include "stdafx.h"
  15. #include "superpad.h"
  16. #include "ipframe.h"
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char BASED_CODE THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CInPlaceFrame
  25.  
  26. IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
  27.  
  28. BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
  29.     //{{AFX_MSG_MAP(CInPlaceFrame)
  30.     ON_WM_CREATE()
  31.     //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // arrays of IDs used to initialize control bars
  36.  
  37. // toolbar buttons - IDs are command buttons
  38. static UINT BASED_CODE buttons[] =
  39. {
  40.     // same order as in the bitmap 'toolbar.bmp'
  41.     ID_EDIT_CUT,
  42.     ID_EDIT_COPY,
  43.     ID_EDIT_PASTE,
  44.         ID_SEPARATOR,
  45.     ID_APP_ABOUT,
  46. };
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CInPlaceFrame construction/destruction
  50.  
  51. CInPlaceFrame::CInPlaceFrame()
  52. {
  53. }
  54.  
  55. CInPlaceFrame::~CInPlaceFrame()
  56. {
  57. }
  58.  
  59. int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  60. {
  61.     if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
  62.         return -1;
  63.  
  64.     if (!m_wndResizeBar.Create(this))
  65.     {
  66.         TRACE0("Failed to create resize bar\n");
  67.         return -1;      // fail to create
  68.     }
  69.     return 0;
  70. }
  71.  
  72. // OnCreateControlBars is called by the framework to create control
  73. //  bars on the client applications windows.
  74. BOOL CInPlaceFrame::OnCreateControlBars(CWnd* pWndFrame, CWnd* /*pWndDoc*/)
  75. {
  76.     // create toolbar on client's frame window
  77.     if (!m_wndToolBar.Create(pWndFrame) ||
  78.         !m_wndToolBar.LoadBitmap(IDR_TEXTTYPE_INPLACE) ||
  79.         !m_wndToolBar.SetButtons(buttons,
  80.           sizeof(buttons)/sizeof(UINT)))
  81.     {
  82.         TRACE0("Failed to create toolbar\n");
  83.         return FALSE;
  84.     }
  85.  
  86.     // set owner to this window, so messages are delivered to correct app
  87.     m_wndToolBar.SetOwner(this);
  88.     return TRUE;
  89. }
  90.  
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CInPlaceFrame diagnostics
  93.  
  94. #ifdef _DEBUG
  95. void CInPlaceFrame::AssertValid() const
  96. {
  97.     COleIPFrameWnd::AssertValid();
  98. }
  99.  
  100. void CInPlaceFrame::Dump(CDumpContext& dc) const
  101. {
  102.     COleIPFrameWnd::Dump(dc);
  103. }
  104.  
  105. #endif //_DEBUG
  106.  
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CInPlaceFrame commands
  109.